import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wwy
 * Date: 2024-11-11
 * Time: 21:47
 */
public class Test2 {
    public static void main(String[] args) {
        int[] arr={1,1,34,323,43,4};
        int l=0;
        int r= arr.length-1;
        while (l<r){
           while (arr[l]%2!=0&&l<r){
               l++;
           }
           while (arr[r]%2==0&&l<r){
               r--;
           }
            swap(arr,l,r);

        }
        System.out.println(Arrays.toString(arr));

    }
    public static void swap(int []arr,int i,int j){
        int t=arr[i];
        arr[i]=arr[j];
        arr[j]=t;
    }
}
